class Solution(object):
    def countEven(self, num):
        def judge(m):
            ans = 0
            while m > 0:
                ans += m % 10
                m //= 10
            return ans % 2 == 0
        ans = 0
        for i in range(1, num + 1):
            ans += judge(i)
        return ans